package com.ruoyi.system.service.impl;

import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.system.domain.AWaring;
import com.ruoyi.system.mapper.AWaringMapper;
import com.ruoyi.system.service.IAWaringService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 告警设置Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-04-10
 */
@Service
public class AWaringServiceImpl implements IAWaringService
{
    @Autowired
    private AWaringMapper aWaringMapper;

    /**
     * 查询告警设置
     * 
     * @return 告警设置
     */
    @Override
    public AWaring selectAWaringByUserId()
    {
        AWaring aWaring = aWaringMapper.selectAWaringByUserId(SecurityUtils.getUserId());
        return aWaring;
    }

    /**
     * 查询告警设置列表
     * 
     * @param aWaring 告警设置
     * @return 告警设置
     */
    @Override
    public List<AWaring> selectAWaringList(AWaring aWaring)
    {
        return aWaringMapper.selectAWaringList(aWaring);
    }

    /**
     * 新增告警设置
     * 
     * @param aWaring 告警设置
     * @return 结果
     */
    @Override
    public int insertAWaring(AWaring aWaring)
    {
        return aWaringMapper.insertAWaring(aWaring);
    }

    /**
     * 修改告警设置
     * 
     * @param aWaring 告警设置
     * @return 结果
     */
    @Override
    public int updateAWaring(AWaring aWaring)
    {
        Long userId = SecurityUtils.getUserId();
        aWaring.setUserId(userId);
        return aWaringMapper.updateAWaring(aWaring);
    }

    /**
     * 批量删除告警设置
     * 
     * @param userIds 需要删除的告警设置主键
     * @return 结果
     */
    @Override
    public int deleteAWaringByUserIds(Long[] userIds)
    {
        return aWaringMapper.deleteAWaringByUserIds(userIds);
    }

    /**
     * 删除告警设置信息
     * 
     * @param userId 告警设置主键
     * @return 结果
     */
    @Override
    public int deleteAWaringByUserId(Long userId)
    {
        return aWaringMapper.deleteAWaringByUserId(userId);
    }
}
